let imgst=undefined;
const Cesium=window.Cesium;
const width=80,height=80;
const comheight=20;
class CreateStation{
    constructor(){
        imgst={
            "CC": "images/stimage/CC.png",
            "DDeng": "images/stimage/DD.png",
            "DPeng": "images/stimage/DP.png",
            "RIMS": "images/stimage/RIMS.png",
            "RIWQ": "images/stimage/RIWQ.png",
            "ZP": "images/stimage/ZP.png",
            "ZQ": "images/stimage/ZQ.png",
            "PP": "images/stimage/PP.png",
            "ZZ": "images/stimage/ZZ.png",
            "VV": "images/stimage/VV.png",
            "PIS": "images/stimage/PIS.png",
            "PIZ": "images/stimage/PIZ.png",
            "PIMS": "images/stimage/PIMS.png",
            "SPWQ": "images/stimage/SPWQ.png",
            "PPWQ": "images/stimage/PPWQ.png",
            "MAWQ": "images/stimage/MAWQ.png",
            "RR": "images/stimage/RR.png",
            "HP": "images/stimage/HP.png",
            "BASE": "images/stimage/BASE.png",
            "RS": "images/stimage/RS.png",
            "RGCYOne": "images/stimage/gd1.png",
            "RGCYTwo": "images/stimage/gd2.png",
            "RGCYThree": "images/stimage/gd3.png",
            "RGCYFour": "images/stimage/gd4.png",
            "RGCYFive": "images/stimage/gd5.png",
            "RGCYSix": "images/stimage/gd6.png",
            "RGCYSev": "images/stimage/gd7.png",
            "RGCYEit": "images/stimage/gd7.png",
            "NorStat": "images/stimage/normal.png",
            "ExnorStat": "images/stimage/exnormal.png",
            "RGJ": "images/Mobile/RYtest.png",
            "RGJPlay": "images/Mobile/RGJPlay.png",
            "RGJCLuster": "images/Mobile/RGJCluster.png",
            "DOWNerrorImg": "images/Mobile/downerror.png",
            "DOWNnormImg": "images/Mobile/downnorm.png",
            "UPnormImg": "images/Mobile/upnorm.png",
            "UPerrorImg": "images/Mobile/uperror.png"
        }
    }

    /**
     * @description
     * @author tpy
     * @annotator hjj
     * @date 2020-05-26
     * @param {string} layername 测站类型名称（EN）
     * @param {Object} entitydata 单个测站监测数据
     * @returns
     * @memberof CreateStation
     */
    CreateStationEntity(layername,entitydata){
        try{
            let stimage=imgst[entitydata.baseInfo.sttp];//测站图标
            if(typeof (stimage)==="undefined"){
                stimage=imgst["BASE"];
            }
            if(entitydata&&entitydata.baseInfo&&entitydata.baseInfo.lgtd&&entitydata.baseInfo.lttd){
                let billboard=new Cesium.Entity({
                    position:new Cesium.Cartesian3.fromDegrees(entitydata.baseInfo.lgtd,entitydata.baseInfo.lttd,comheight),
                    billboard:{
                        image:stimage,
                        width:width,
                        height:height,
                        scale:0.5,
                        eyeOffset:new Cesium.ConstantProperty(new Cesium.Cartesian3(0, 0, -100)),
                        scaleByDistance: new Cesium.NearFarScalar(1000, 1.5, 30000, 0.5),//随距离缩放标注大小
                        distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 300000)//可见距离范围
                    },
                    id:entitydata.baseInfo.stcd,
                    name:layername,
                });
                billboard.properties=entitydata.Value;
                billboard.warnInfo = (entitydata.warnInfo?entitydata.warnInfo:{});//预警判断条件信息 tianzezhong 2020-07-01
                billboard.stnm=entitydata.baseInfo.stnm;
                let CZkey="CZ";
                billboard.layername=CZkey;
                return billboard;
            }            
        }catch (e) {
             console.log("测站实体创建失败：",e);
        }
        return undefined;
    }
}
module.exports=CreateStation;